﻿using B.S.DataBase.MyProject.Domain.wdx;
using B.S.DataBase.MyProject.ErrorCode;
using MediatR;
using MedicalPCTerminal.Read.API.Appcation.Commands.DoctorCommand;
using MedicalPCTerminal.Read.API.Appcation.Commands.OperationaldecisionsCommand;
using MedicalPCTerminal.Read.API.Dtos;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace MedicalPCTerminal.Read.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    //[Authorize]
    public class MedicalController : ControllerBase
    {
        private readonly IMediator mediator;

        public MedicalController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 医护移动端患者列表查询
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<List<ResidentFiles>>> ResidentFilesmoveQuery([FromQuery]ResidentFilesmoveQueryCommand request)
        {
            try
            {
                return await mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 医护移动端患者健康档案查询
        /// </summary>
        /// <param name="request"></param>PatientInfoQuery
        /// <returns></returns>
        [HttpGet]
        public async Task<ApiPaging<PatientInforDtos>> PatientInfoQuery([FromQuery]PatientInforQueryCommand request)
        {
            try
            {
                return await mediator.Send(request);
            
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 层级和工作量
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ApiPaging<ManagementhierarchyDto>> ManagementhierarchyQuery([FromQuery] ManagementhierarchyQueryCommand request)
        {
            try
            {

                return await mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 管理概况
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]

        public async Task<ApiPaging<ManagementOverviewDto>> ManagementOverviewQuery([FromQuery]ManagementOverviewCommand request, CancellationToken cancellationToken)
        {
            try
            {

                return await mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
}
